package com.yidi.system.service.imp;

import com.yidi.system.domain.SysRoleDept;
import com.yidi.system.repository.SysRoleDeptRepository;
import com.yidi.system.service.SysRoleDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ：Xn
 * @ClassName: SysRoleDeptServiceImpl
 * @date ：2021-10-19 14:18
 * @describe ：
 */
@Service
public class SysRoleDeptServiceImpl implements SysRoleDeptService {

    @Autowired
    private SysRoleDeptRepository sysRoleDeptRepository;

    @Override
    public void deleteRoleDeptByRoleId(Long roleId) {
        sysRoleDeptRepository.deleteRoleDeptByRoleId(roleId);
    }

    @Override
    public void batchRoleDept(List<SysRoleDept> list) {
        for(SysRoleDept rd : list){
            sysRoleDeptRepository.save(rd);
        }
    }

    @Override
    public void deleteRoleDept(Long[] roleIds){
        for(Long roleId : roleIds){
            deleteRoleDeptByRoleId(roleId);
        }
    }
}
